package com.itheima.demo;

public class movieoperator {
    private movie []movies;
    public movieoperator() {
    }
    public movieoperator(movie[] movies) {
        this.movies = movies;
    }
    public void printAllMovies() {
        System.out.println("编号\t\t电影名称\t\t电影价格\\");
        for (int i = 0; i < movies.length; i++) {
            System.out.println(movies[i].getId() + "\t\t" + movies[i].getName()+  "\t\t"+movies[i].getPrice());
        }
    }

    public void searchMovieByid( int id) {
        for (int i = 0; i < movies.length; i++) {
            if (movies[i].getId() == id) {
                System.out.println("编号\t\t电影名称\t\t电影类型\t\t电影评分");
                System.out.println(movies[i].getId() + "\t\t" + movies[i].getName() +  "\t\t" + movies[i].getPrice());
                return;
            }
        }
        System.out.println("没有找到该电影");
    }
}
